#{extends 'CRUD/layout.html' /}

<script type="text/javascript" src="@{'/tinymce/jscripts/tiny_mce/jquery.tinymce.js'}"></script>
 
<h3>Write, <span>a new post</span></h3>
<div class="objectForm">
#{form @save()}
 
    #{ifErrors}
        <p class="error">
            Please correct these errors.
        </p>
    #{/ifErrors}
    <div class="objectForm">
    <p>
        #{field 'title'}
        <label>标题:</label>
        <input type="text" name="${field.name}" size="50" 
            value="${post?.title}" class="${field.errorClass}" />
        #{/field}
    </p>
 
    <p>
        #{field 'content'}
        <label>内容:</label>
        <textarea name="${field.name}" 
            class="${field.errorClass} tinymce">${post?.content}</textarea>
        #{/field}
    </p>
    
    <script type="text/javascript"> 
    		$().ready(function() {
					$('textarea.tinymce').tinymce({
						script_url : "@{'/tinymce/jscripts/tiny_mce/tiny_mce.js'}",
						theme : "advanced",
						// Theme options
						theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
						theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
						theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "bottom",
						theme_advanced_resizing : true
					});
				});
  	</script> 
 		<p>
 				<label for="object_status">状态</label> 
				<input id="object_status" class="" type="checkbox" name="object.status" value="true"  size="50" /> 
				<input type="hidden" name="object.status" value="false" /> 
 		</p>
 		
    <p>
        #{field 'tags'}
        <label>标签:</label>
        <input type="text" size="50" 
            name="${field.name}" value="${post?.tags?.join(' ')}" />
        #{/field}
    </p>
    
    <p class="crudButtons">
        <input type="submit" value="发布博客" />
    </p>
    </div>
#{/form}
</div>